<extend name="Public/base" />

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>{$title}内容列表
			<eq name="model.extend" value="1"><a href="{:U('edit',array('name'=>$name))}">新 增</a></eq>
		</h2>
	</div>

	<form class="form-search form-inline search-form" action="{:U('adminList','name='.$name,false)}" method="get" >
		<input type="text" name="{$model['search_key']|default='title'}" class="search-input" value="{:I('title')}" placeholder="请输入关键字">
		<button type="submit" url="{:U('adminList','name='.$name,false)}" id="search">筛选</button>
	</form>

	<!-- 数据列表 -->
	<div class="typecho-table-wrap">
		<form action="{:U('del')}" method="post" id="del_form">
		<empty name="custom_adminlist">
			<!-- 数据列表 -->
			<table class="table table-hover">
				<thead>
					<tr>
						<th width="40">
							<input class="check-all" type="checkbox">序号
						</th>
						<volist name="list_grid" id="vo">
							<th>{$vo.title}</th>
						</volist>
					</tr>
				</thead>
				<tbody>
					<volist name="_list" id="lv" key="vo">
					<tr>
						<td><input class="ids" type="checkbox" value="{$lv.id}" name="ids[]">{$lv.id}</td>
						<volist name="list_grid" id="lk">
							<td>{:get_addonlist_field($lv, $lk, $name)}</td>
						</volist>
					</tr>
					</volist>
				</tbody>
			</table>
		<else />
			<present name="custom_adminlist">
				{$custom_adminlist}
			</present>
		</empty>
		</form>
	</div>
	<!-- 分页 -->
	<div class="pagination pagination-right">
		<eq name="model.extend" value="1">
        	<button class="pull-left ajax-post confirm" id="batch_del">删 除</button>
        </eq>
        {$_page}
    </div>
</block>
<block name="js">
	<script type="text/javascript">
		$(function(){
			//搜索功能
			$("#search").click(function(){
				var url = $(this).attr('url');
				var query  = $('.search-form').find('input,select').serialize();
				query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
				query = query.replace(/^&/g,'');
				if( url.indexOf('?')>0 ){
					url += '&' + query;
				}else{
					url += '?' + query;
				}
				window.location.href = url;
			});
			$('.data-table th:last').attr('width',52);
			//回车自动提交
			$('.search-form').find('input').keyup(function(event){
				if(event.keyCode===13){
					$("#search").click();
				}
			});
			$('th').css('width', $(this).outerWidth());
		})
	</script>
</block>
